<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    //实例方法：被实例后才可以访问的属性
    //静态方法：实例前，类可以访问

    // function Person(name, age) {
    //   this.name = name
    //   this.age = age
    // }
    // Person.age = 20;
    // //实例方法
    // Person.prototype.show = () => {
    //   console.log('show实例方法')
    // }
    // //静态方法
    // Person.show = () => {
    //   console.log('show静态方法')
    // }
    // let person1 = new Person('mashaodong', 18)
    // person1.show()
    // Person.show()

    //class类静态方法
    class Person {
      static age = 20;
      static show = () => {
        console.log('show静态方法')
      }
      constructor(name, age) {
        this.name = name
        this.age = age
      }
      show = () => {
        console.log('show实例方法')
      }
    }
    let person1 = new Person('mashaodong', 18)
    person1.show()
    Person.show()
  </script>
</body>

</html>